package com.xly.webclick.vm;

import android.annotation.SuppressLint;
import android.app.Instrumentation;
import android.content.DialogInterface;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.webkit.JsResult;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import com.xly.webclick.JSUseAndroid;
import com.xly.webclick.base.BaseViewModel;
import com.xly.webclick.model.TaskData;
import com.xly.webclick.utils.StringUtils;
import com.xly.webclick.view.TaskActivity;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.ref.WeakReference;
import java.util.concurrent.TimeUnit;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;

/**
 * Created by xuleyuan on 2018/8/18
 */

public class TaskViewModel extends BaseViewModel {

    private WebView webView;
    private WebSettings wSettings;

    private double[] p;
    private float scale = 1;
    private int offsetLeft;
    private int offsetTop;
    private int offsetWidth;
    private int offsetHeight;
    private double stateBarHeight;
    private double titleBarHeight;
    private String jsFile;
    private TaskData taskData;

    public TaskViewModel(TaskActivity view) {
        super(view);
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        initWebView();
        webView.loadUrl("https://m.baidu.com/");
    }

    @Override
    public void onResume() {

    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        this.stateBarHeight = getStateBarHeight();
        this.titleBarHeight = 0;
        this.scale = getscale(webView);
        Log.d("状态栏高度：", String.valueOf(this.stateBarHeight));
        Log.d("标题栏高度：", String.valueOf(this.titleBarHeight));
        Log.d("缩放比例：", String.valueOf(this.scale));

    }


    @SuppressLint("SetJavaScriptEnabled")
    private void initWebView() {

        webView = ((TaskActivity)getActivity()).binding.webView;
        this.wSettings = webView.getSettings();
        this.wSettings.setDefaultTextEncodingName("GBK");
        this.wSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        this.wSettings.setJavaScriptEnabled(true);
        this.wSettings.setDomStorageEnabled(true);
        wSettings.setSupportZoom(false);

        this.wSettings.setBuiltInZoomControls(true);
        this.wSettings.setUseWideViewPort(true);
        this.wSettings.setLoadWithOverviewMode(true);
        this.wSettings.setLightTouchEnabled(true);
        this.wSettings.setUserAgentString("");
        this.webView.addJavascriptInterface(new JSUseAndroid(), "JStoAnroid");
        jsFile = StringUtils.getJson("jquery_2.0.0.min.js", getActivity()) + "var $jscomp = $jscomp || {};\n" +
                "$jscomp.scope = {};\n" +
                "$jscomp.findInternal = function(a, c, b) {\n" +
                "\ta instanceof String && (a = String(a));\n" +
                "\tfor (var d = a.length, f = 0; f < d; f++) {\n" +
                "\t\tvar g = a[f];\n" +
                "\t\tif (c.call(b, g, f, a)) return {\n" +
                "\t\t\ti: f,\n" +
                "\t\t\tv: g\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn {\n" +
                "\t\ti: -1,\n" +
                "\t\tv: void 0\n" +
                "\t}\n" +
                "};\n" +
                "$jscomp.ASSUME_ES5 = !1;\n" +
                "$jscomp.ASSUME_NO_NATIVE_MAP = !1;\n" +
                "$jscomp.ASSUME_NO_NATIVE_SET = !1;\n" +
                "$jscomp.defineProperty = $jscomp.ASSUME_ES5 || \"function\" == typeof Object.defineProperties ? Object.defineProperty : function(a, c, b) {\n" +
                "\ta != Array.prototype && a != Object.prototype && (a[c] = b.value)\n" +
                "};\n" +
                "$jscomp.getGlobal = function(a) {\n" +
                "\treturn \"undefined\" != typeof window && window === a ? a : \"undefined\" != typeof global && null != global ? global : a\n" +
                "};\n" +
                "$jscomp.global = $jscomp.getGlobal(this);\n" +
                "$jscomp.polyfill = function(a, c, b, d) {\n" +
                "\tif (c) {\n" +
                "\t\tb = $jscomp.global;\n" +
                "\t\ta = a.split(\".\");\n" +
                "\t\tfor (d = 0; d < a.length - 1; d++) {\n" +
                "\t\t\tvar f = a[d];\n" +
                "\t\t\tf in b || (b[f] = {});\n" +
                "\t\t\tb = b[f]\n" +
                "\t\t}\n" +
                "\t\ta = a[a.length - 1];\n" +
                "\t\td = b[a];\n" +
                "\t\tc = c(d);\n" +
                "\t\tc != d && null != c && $jscomp.defineProperty(b, a, {\n" +
                "\t\t\tconfigurable: !0,\n" +
                "\t\t\twritable: !0,\n" +
                "\t\t\tvalue: c\n" +
                "\t\t})\n" +
                "\t}\n" +
                "};\n" +
                "$jscomp.polyfill(\"Array.prototype.find\", function(a) {\n" +
                "\treturn a ? a : function(a, b) {\n" +
                "\t\treturn $jscomp.findInternal(this, a, b).v\n" +
                "\t}\n" +
                "}, \"es6\", \"es3\");\n" +
                "try {\n" +
                "\tvar $j = jQuery.noConflict()\n" +
                "} catch (a) {\n" +
                "\talert(\"err101:\" + a)\n" +
                "}\n" +
                "window.ele;\n" +
                "\n" +
                "function testw() {\n" +
                "\t$j(\"#test\").val(\"ddd\");\n" +
                "\treturn \"hellow\"\n" +
                "}\n" +
                "function CloseTaoBaoTip() {\n" +
                "\tvar a = \"false\";\n" +
                "\tfor (i = 0; i < document.all.length; i++) {\n" +
                "\t\tvar c = document.all[i];\n" +
                "\t\tif (\"A\" == c.tagName && -1 < c.outerHTML.indexOf(\"_close\")) {\n" +
                "\t\t\tc.style.background = \"red\";\n" +
                "\t\t\tc.click();\n" +
                "\t\t\ta = \"true\";\n" +
                "\t\t\tbreak\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn a\n" +
                "}\n" +
                "function GetBackArrow() {\n" +
                "\tvar a = \"false\";\n" +
                "\tfor (i = 0; i < document.all.length; i++) {\n" +
                "\t\tvar c = document.all[i];\n" +
                "\t\tif (\"DIV\" == c.tagName && \"arrow_back\" == c.getAttribute(\"class\")) {\n" +
                "\t\t\tc.style.background = \"red\";\n" +
                "\t\t\tc.click();\n" +
                "\t\t\ta = \"true\";\n" +
                "\t\t\tbreak\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn a\n" +
                "}\n" +
                "function GetPos_PingLun() {\n" +
                "\tvar a = \"false\";\n" +
                "\tfor (i = 0; i < document.all.length; i++) {\n" +
                "\t\tvar c = document.all[i];\n" +
                "\t\tif (\"P\" == c.tagName && -1 < c.innerText.indexOf(\"\\u67e5\\u770b\\u5168\\u90e8\\u8bc4\\u4ef7\")) {\n" +
                "\t\t\tc.style.background = \"red\";\n" +
                "\t\t\tc.scrollIntoView();\n" +
                "\t\t\tc.click();\n" +
                "\t\t\ta = \"true\";\n" +
                "\t\t\tbreak\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn a\n" +
                "}\n" +
                "function Closetip_58() {\n" +
                "\t$j(\"#but01\").click()\n" +
                "}\n" +
                "function Closetip_tmall() {\n" +
                "\tvar a = $j(\"._3XgMwL3i1WVZj7BF2oecRE\");\n" +
                "\ta = a.parent();\n" +
                "\ta = a.next();\n" +
                "\ta.click()\n" +
                "}\n" +
                "function InputKey_Tmall1() {\n" +
                "\tvar a = $j(\"span\");\n" +
                "\ta = a.filter(function() {\n" +
                "\t\treturn \"\\u641c\\u7d22\\u5546\\u54c1\\u3001\\u54c1\\u724c\" == $j(this).text()\n" +
                "\t});\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputKey_Tmall2(a, c) {\n" +
                "\tvar b = $j(\"#mq\");\n" +
                "\ta && b.val(c);\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function InputKey_JD1() {\n" +
                "\tvar a = $j(\"#index_newkeyword\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputKey_JD2(a) {\n" +
                "\tvar c = $j(\"#index_newkeyword\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputKey_58() {\n" +
                "\tvar a = $j(\"#searchUrl\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputKey_pdd() {\n" +
                "\tvar a = $j(\"#result-input\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputKey_pdd2(a) {\n" +
                "\tvar c = $j(\"#view-input\");\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputKey_582(a) {\n" +
                "\tvar c = $j(\"#keyWords1\");\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function GetPos_ZhiDaoNextPage() {\n" +
                "\tvar a = $j(\"a.u-refresh\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputKey_ZhiDao1() {\n" +
                "\tvar a = $j(\"span.search-logo\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputKey_ZhiDao(a) {\n" +
                "\tvar c = $j(\"input.search-input\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputKey_ZhiDao_a() {\n" +
                "\tvar a = $j(\"input.search-input\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function inputKey_1688(a) {\n" +
                "\ta = $j(\"span.search-text\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function inputKey_16882(a) {\n" +
                "\tvar c = $j(\"input[placeholder]\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function Input1688_XGSS_Step2() {\n" +
                "\te = $j(\"div.ws-mod-main\");\n" +
                "\treturn GetjQueryObjPosition(e)\n" +
                "}\n" +
                "function InputKey_1688XGSS2(a) {\n" +
                "\te = $j(\"input.wsw-keywords\");\n" +
                "\tSetBgColor(e, \"red\");\n" +
                "\te.val(a);\n" +
                "\treturn GetjQueryObjPosition(e)\n" +
                "}\n" +
                "function inputKey_taobao(a) {\n" +
                "\ta = $j(\".text.iconfont.icon-search\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function inputKey_taobao2(a, c) {\n" +
                "\tvar b = $j(\"input.J_autocomplete\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t});\n" +
                "\tSetBgColor(b, \"green\");\n" +
                "\ta && (b.focus(), b.val(c));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function inputKey_taobao3(a) {\n" +
                "\tvar c = $j(\"input.J_autocomplete\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t});\n" +
                "\tSetBgColor(c, \"red\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function GetSubmitBtnPos_Mobile(a) {\n" +
                "\tif (-1 < a.indexOf(\"www.baidu.com\")) var c = $j(\"#index-bn\");\n" +
                "\telse -1 < a.indexOf(\"taobao.com\") ? c = $j(\"input.icons-search\") : -1 < a.indexOf(\"www.sogou.com\") ? (c = $j(\"input.qbtn\"), 0 < c.length && (c = c.eq(0))) : -1 < a.indexOf(\"www.so.com\") ? c = $j(\"button.search-btn\") : -1 < a.indexOf(\"www.1688.com\") ? c = $j(\"i.icon.search.top_search-icon\") : -1 < a.indexOf(\"www.tmall.com\") ? c = $j(\"input[type='submit']\") : -1 < a.indexOf(\"www.jd.com\") ? c = $j(\"#index_search_submit\") : -1 < a.indexOf(\"sm.cn\") ? (c = $j(\"div.btn.submit\"), c = c.find(\"span\")) : -1 < a.indexOf(\"bing.com\") ? c = $j(\"#sbBtn\") : -1 < a.indexOf(\"zhidao.baidu.com\") ? c = $j(\"span.search-action.enter-action\") : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") && (c = $j(\"div.submit-button-view\"));\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function GetSubmitBtnPos_Mobile_XGSS(a) {\n" +
                "\tif (-1 < a.indexOf(\"www.baidu.com\")) var c = $j(\"#se-bn\");\n" +
                "\telse -1 < a.indexOf(\"taobao.com\") ? c = $j(\"input.icons-search\") : -1 < a.indexOf(\"www.sogou.com\") ? (c = $j(\"input.qbtn\"), 0 < c.length && (c = c.eq(0))) : -1 < a.indexOf(\"www.so.com\") ? c = $j(\"button.g-header-search-button\") : -1 < a.indexOf(\"www.1688.com\") ? c = $j(\"i.icon.search.top_search-icon\") : -1 < a.indexOf(\"www.tmall.com\") ? c = $j(\"input[type='submit']\") : -1 < a.indexOf(\"www.jd.com\") ? (c = $j(\"#msSearchBtn\"), c = c.find(\"span\")) : -1 < a.indexOf(\"sm.cn\") ? (c = $j(\"div.btn.submit\"), c = c.find(\"span\")) : -1 < a.indexOf(\"bing.com\") ? c = $j(\"#sb_form_go\") : -1 < a.indexOf(\"zhidao.baidu.com\") ? c = $j(\".search-action.enter-action\") : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") && (c = $j(\"div.submit-button-view\"));\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function GetPosBingXGSSBtn() {\n" +
                "\tvar a = $j(\"#sb_form_go\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetPos_1688XGSS2_SubmitBtn() {\n" +
                "\tvar a = $j(\"span.wsw-search\");\n" +
                "\ta = a.find(\".wsw-icon\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetPosInput_JDXGSS() {\n" +
                "\tvar a = $j(\"#layout_newkeyword\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetPosJDXGSS_SubBtn() {\n" +
                "\tvar a = $j(\"#layout_search_submit\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function Input_JDXGSS(a) {\n" +
                "\tvar c = $j(\"#layout_newkeyword\");\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\tc.val(a);\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function inputKey_sogou(a) {\n" +
                "\tvar c = \"false\",\n" +
                "\t\tb = document.getElementById(\"keyword\");\n" +
                "\tif (b) {\n" +
                "\t\tc = getPosInDom(b);\n" +
                "\t\tvar d = c[0],\n" +
                "\t\t\tf = c[1],\n" +
                "\t\t\tg = c[2],\n" +
                "\t\t\tl = c[3];\n" +
                "\t\tb.value = a;\n" +
                "\t\tc = \"true\"\n" +
                "\t}\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: c,\n" +
                "\t\toffsetLeft: d,\n" +
                "\t\toffsetTop: f,\n" +
                "\t\toffsetWidth: g,\n" +
                "\t\toffsetHeight: l\n" +
                "\t})\n" +
                "}\n" +
                "function InputKey_Mobile(a) {\n" +
                "\tif (-1 < a.indexOf(\"baidu.com\")) var c = $j(\"#index-kw\");\n" +
                "\telse -1 < a.indexOf(\"www.sogou.com\") ? c = $j(\"#keyword\") : -1 < a.indexOf(\"www.so.com\") ? c = $j(\"#q\") : -1 < a.indexOf(\"58.com\") ? c = $j(\"#searchUrl\") : -1 < a.indexOf(\"sm.cn\") ? c = $j(\"#kw\") : -1 < a.indexOf(\"bing.com\") ? c = $j(\"#sb_form_q\") : -1 < a.indexOf(\"jd.com\") ? c = $j(\"#index_newkeyword\") : -1 < a.indexOf(\"1688.com\") ? c = $j(\"span.search-text\") : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") ? c = $j(\"#result-input\") : -1 < a.indexOf(\"taobao.com\") ? c = $j(\"span.text.iconfont.icon-search\") : -1 < a.indexOf(\"tmall.com\") ? (c = $j(\"span\"), c = c.filter(function() {\n" +
                "\t\treturn \"\\u641c\\u7d22\\u5546\\u54c1\\u3001\\u54c1\\u724c\" == $j(this).text()\n" +
                "\t})) : -1 < a.indexOf(\"zhidao.baidu.com\") && (c = $j(\"input.search-input\"));\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputKey_Mobile2(a, c) {\n" +
                "\tif (-1 < a.indexOf(\"baidu.com\")) var b = $j(\"#index-kw\");\n" +
                "\telse -1 < a.indexOf(\"www.sogou.com\") ? b = $j(\"#keyword\") : -1 < a.indexOf(\"www.so.com\") ? b = $j(\"#q\") : -1 < a.indexOf(\"58.com\") ? (b = $j(\"#searchUrl\"), b.click(), b = $j(\"#keyWords1\")) : -1 < a.indexOf(\"sm.cn\") ? b = $j(\"#kw\") : -1 < a.indexOf(\"bing.com\") ? b = $j(\"#sb_form_q\") : -1 < a.indexOf(\"jd.com\") ? b = $j(\"#index_newkeyword\") : -1 < a.indexOf(\"1688.com\") ? b = $j(\"input.top_input-text\") : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") ? b = $j(\"#view-input\") : -1 < a.indexOf(\"taobao.com\") ? b = $j(\"input.J_autocomplete\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}) : -1 < a.indexOf(\"tmall.com\") ? b = $j(\"#mq\") : -1 < a.indexOf(\"zhidao.baidu.com\") && (b = $j(\"input.search-input\"));\n" +
                "\t0 < b.length && (b.focus(), b.val(c));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function FindInput(a) {\n" +
                "\tif (-1 < a.indexOf(\"1688.com\")) var c = $j(\"span.bar_search-btn_text\");\n" +
                "\telse -1 < a.indexOf(\"tmall.com\") ? (c = $j(\"div.searchbar.j_searchbar\"), c = c.find(\"ul\")) : -1 < a.indexOf(\"58.com\") && (c = $j(\"#searchUrl\"));\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputKey_Mobile_XGSS(a, c, b) {\n" +
                "\tvar d; - 1 < a.indexOf(\"www.baidu.com\") ? d = $j(\"#kw\") : -1 < a.indexOf(\"www.sogou.com\") ? d = $j(\"#keyword\") : -1 < a.indexOf(\"www.so.com\") ? d = $j(\"#q\") : -1 < a.indexOf(\"58.com\") ? d = $j(\"#keyWords1\") : -1 < a.indexOf(\"sm.cn\") ? d = $j(\"textarea.se-input\") : -1 < a.indexOf(\"bing.com\") ? d = $j(\"#sb_form_q\") : -1 < a.indexOf(\"jd.com\") ? d = $(\"#msKeyWord\") : -1 < a.indexOf(\"1688.com\") ? d = $j(\"input.top_input-text\") : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") ? d = $j(\"#view-input\") : -1 < a.indexOf(\"taobao.com\") ? d = $j(\"input.J_autocomplete\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}) : -1 < a.indexOf(\"tmall.com\") && (d = $j(\"#mq\"));\n" +
                "\t0 < d.length && b && (d.focus(), d.val(c));\n" +
                "\treturn GetjQueryObjPosition(d)\n" +
                "}\n" +
                "function press1() {\n" +
                "\tsetTimeout(\"pressEnter()\", 5E3)\n" +
                "}\n" +
                "currentPosition = 0;\n" +
                "timer = null;\n" +
                "\n" +
                "function GoBottom() {\n" +
                "\ttimer = setInterval(\"runToBottom()\", 50)\n" +
                "}\n" +
                "function runToBottom() {\n" +
                "\tcurrentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n" +
                "\tcurrentPosition += 10;\n" +
                "\tcurrentPosition < document.body.scrollHeight && document.body.clientHeight + document.body.scrollTop < document.body.scrollHeight ? document.body.scrollTop = currentPosition : (document.body.scrollTop = document.body.scrollHeight, clearInterval(timer))\n" +
                "}\n" +
                "var currentPosition, timer;\n" +
                "\n" +
                "function GoTop() {\n" +
                "\ttimer = setInterval(\"runToTop()\", 50)\n" +
                "}\n" +
                "function runToTop() {\n" +
                "\tcurrentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n" +
                "\tcurrentPosition -= 10;\n" +
                "\t0 < currentPosition ? window.scrollTo(0, currentPosition) : (window.scrollTo(0, 0), clearInterval(timer))\n" +
                "}\n" +
                "function getRandomLink() {\n" +
                "\tvar a = \"false\",\n" +
                "\t\tc = 0,\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = 0,\n" +
                "\t\tg = 0,\n" +
                "\t\tl = 0;\n" +
                "\t\"CSS1Compat\" == document.compatMode ? (g = document.documentElement.clientHeight, l = document.documentElement.clientWidth) : \"BackCompat\" == document.compatMode && (g = document.body.clientHeight, l = document.body.clientWidth);\n" +
                "\tvar h = $j(\"a:visible\");\n" +
                "\th = h.filter(function() {\n" +
                "\t\treturn 0 < $j(this).width() && 0 < $j(this).height()\n" +
                "\t});\n" +
                "\th = h.filter(function() {\n" +
                "\t\treturn 0 < $j(this).offset().left && 0 < $j(this).offset().top\n" +
                "\t});\n" +
                "\tvar m = h.length;\n" +
                "\tif (0 < m) {\n" +
                "\t\tvar k = h.eq(Math.ceil(Math.random() * m));\n" +
                "\t\tSetBgColor(k, \"red\");\n" +
                "\t\tk.prop(\"outerHTML\")\n" +
                "\t}\n" +
                "\t0 < k.length && (window.ele = k[0], a = GetPos_query(k), c = a[0], b = a[1], d = a[2], f = a[3], a = \"true\");\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: a,\n" +
                "\t\toffsetLeft: c,\n" +
                "\t\toffsetTop: b,\n" +
                "\t\twidth: d,\n" +
                "\t\theight: f,\n" +
                "\t\tclientHeight: g,\n" +
                "\t\tclientWidth: l\n" +
                "\t})\n" +
                "}\n" +
                "function getRandomLink_pdd() {\n" +
                "\tvar a = \"false\",\n" +
                "\t\tc = 0,\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = 0,\n" +
                "\t\tg = 0,\n" +
                "\t\tl = 0;\n" +
                "\t\"CSS1Compat\" == document.compatMode ? (g = document.documentElement.clientHeight, l = document.documentElement.clientWidth) : \"BackCompat\" == document.compatMode && (g = document.body.clientHeight, l = document.body.clientWidth);\n" +
                "\tvar h = $j(\"div:visible\");\n" +
                "\th = h.filter(function() {\n" +
                "\t\treturn 0 < $j(this).width() && 0 < $j(this).height()\n" +
                "\t});\n" +
                "\th = h.filter(function() {\n" +
                "\t\treturn 0 < $j(this).offset().left && 0 < $j(this).offset().top\n" +
                "\t});\n" +
                "\tvar m = h.length;\n" +
                "\tif (0 < m) {\n" +
                "\t\tvar k = h.eq(Math.ceil(Math.random() * m));\n" +
                "\t\tSetBgColor(k, \"red\");\n" +
                "\t\tk.prop(\"outerHTML\")\n" +
                "\t}\n" +
                "\t0 < k.length && (window.ele = k[0], a = GetPos_query(k), c = a[0], b = a[1], d = a[2], f = a[3], a = \"true\");\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: a,\n" +
                "\t\toffsetLeft: c,\n" +
                "\t\toffsetTop: b,\n" +
                "\t\twidth: d,\n" +
                "\t\theight: f,\n" +
                "\t\tclientHeight: g,\n" +
                "\t\tclientWidth: l\n" +
                "\t})\n" +
                "}\n" +
                "function dd() {\n" +
                "\tsleep(5E3);\n" +
                "\talert(\"dd\")\n" +
                "}\n" +
                "function sleep(a) {\n" +
                "\tvar c = new Date;\n" +
                "\tfor (a = c.getTime() + a; !(c = new Date, c.getTime() > a););\n" +
                "}\n" +
                "function CloseSoTip() {\n" +
                "\t$j(\"#msocomBottomBanner\").children().eq(0).click()\n" +
                "}\n" +
                "function CloseBingTip() {\n" +
                "\t$j(\"#ta_close\").click()\n" +
                "}\n" +
                "function CloseTmallTip() {\n" +
                "\t$j(\"._37q7S-plh5gq1GTE2RKpR9\").hide()\n" +
                "}\n" +
                "function CloseTip_1688() {\n" +
                "\tvar a = $j(\"div.call-app-colse\");\n" +
                "\ta = a.find(\"img\");\n" +
                "\ta.click()\n" +
                "}\n" +
                "function CloseBaiduTip() {\n" +
                "\t$j(\"div.page-banner\").hide()\n" +
                "}\n" +
                "function InputKey(a, c, b) {\n" +
                "\tif (-1 < a.indexOf(\"www.baidu.com\")) var d = $j(\"#kw\");\n" +
                "\telse -1 < a.indexOf(\"www.so.com\") ? \"False\" == b ? d = $j(\"#input\") : \"True\" == b && (d = $j(\"#keyword\")) : -1 < a.indexOf(\"www.taobao.com\") ? d = $j(\"#q\") : -1 < a.indexOf(\"www.sogou.com\") ? \"False\" == b ? d = $j(\"#query\") : \"True\" == b && (d = $j(\"#upquery\")) : -1 < a.indexOf(\"www.1688.com\") ? \"False\" == b ? d = $j(\"#alisearch-keywords\") : \"True\" == b && (d = $j(\"input[name='keywords']:first\")) : -1 < a.indexOf(\"www.tmall.com\") ? d = $j(\"#mq\") : -1 < a.indexOf(\"www.jd.com\") ? d = $j(\"#key\") : -1 < a.indexOf(\"58.com\") ? \"False\" == b ? d = $j(\"#keyword\") : \"True\" == b && (d = $j(\"#keyword1\")) : -1 < a.indexOf(\"www.bing.com\") ? d = $j(\"#sb_form_q\") : -1 < a.indexOf(\"zhidao.baidu.com\") ? d = $j(\"#kw\") : -1 < a.indexOf(\"www.so.com\") ? \"False\" == b ? d = $j(\"#input\") : \"True\" == b && (d = $j(\"#keyword\")) : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") && (\"False\" == b ? d = $j(\"#view-input\") : \"True\" == b && (d = $j(\"#view-input\")));\n" +
                "\t0 < d.length && (SetBgColor(d, \"red\"), d.focus(), d.val(c));\n" +
                "\treturn \"true\"\n" +
                "}\n" +
                "function GetElement(a, c) {\n" +
                "\tresult = null;\n" +
                "\tfor (i = 0; i < document.all.length; i++) if (e = document.all[i], getAttr(e, a) == c && 0 < e.offsetWidth) {\n" +
                "\t\tresult = e;\n" +
                "\t\tbreak\n" +
                "\t}\n" +
                "\treturn result\n" +
                "}\n" +
                "function getpos(a, c) {\n" +
                "\tvar b = !1;\n" +
                "\tfor (i = 0; i < document.all.length; i++) {\n" +
                "\t\tvar d = document.all[i];\n" +
                "\t\tif (d.getAttribute(a) == c) {\n" +
                "\t\t\td.style.background = \"red\";\n" +
                "\t\t\tb = !0;\n" +
                "\t\t\td.focus();\n" +
                "\t\t\tbreak\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn b\n" +
                "}\n" +
                "function getsx() {\n" +
                "\tvar a = document.getElementById(\"test\").getAttribute(\"class\");\n" +
                "\talert(a)\n" +
                "}\n" +
                "function printbool(a) {\n" +
                "\talert(a)\n" +
                "}\n" +
                "function clickme() {\n" +
                "\tdocument.getElementById(\"a\").click()\n" +
                "}\n" +
                "function println() {\n" +
                "\tvar a = isfind();\n" +
                "\talert(a)\n" +
                "}\n" +
                "function isfind() {\n" +
                "\treturn document.getElementById(\"index-bn\") ? !0 : !1\n" +
                "}\n" +
                "function SetNullValue(a) {\n" +
                "\tnull == a && (a = \"\");\n" +
                "\treturn a\n" +
                "}\n" +
                "function setColor(a, c) {}\n" +
                "function getPosInDom(a) {\n" +
                "\tfor (var c = a.offsetWidth, b = a.offsetHeight, d = a.offsetTop, f = a.offsetLeft; a = a.offsetParent;) d += a.offsetTop, f += a.offsetLeft;\n" +
                "\treturn [f, d, c, b]\n" +
                "}\n" +
                "function getAttr(a, c) {\n" +
                "\treturn a.getAttribute(c) ? a.getAttribute(c) : \"\"\n" +
                "}\n" +
                "function GetPos_BaiDu(a, c) {\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tc = $j(\"div.c-container\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tvar b = c.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"m.baidu.com/from\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a\").first(); - 1 < b.attr(\"href\").toLowerCase().indexOf(\"m.baidu.com/from\") && SetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (c = $j(\"div.c-container,div.ec_resitem\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"m.baidu.com/baidu\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a\").first(), -1 < b.attr(\"href\").toLowerCase().indexOf(\"m.baidu.com/baidu\") && SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function pressEnter() {\n" +
                "\tconsole.log(\"\\u8c03\\u7528Android\\u70b9\\u51fb\\u56de\\u8f66\");\n" +
                "\tJStoAnroid.pressEnter()\n" +
                "}\n" +
                "function NextPage_Mobile(a) {\n" +
                "\tvar c; - 1 < a.indexOf(\"www.baidu.com\") ? c = $j(\"a[class*='new-nextpage']\") : -1 < a.indexOf(\"www.sogou.com\") ? c = $j(\"#ajax_next_page\") : -1 < a.indexOf(\"58.com\") ? c = $j(\"a.pagenext\") : -1 < a.indexOf(\"sm.cn\") ? c = $j(\"#pager\") : -1 < a.indexOf(\"so.com\") && (c = $j(\"#load-more\"));\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function getpos_BaiduNextPage(a, c) {\n" +
                "\tvar b = \"false\";\n" +
                "\tfor (i = 0; i < document.all.length; i++) {\n" +
                "\t\tvar d = document.all[i];\n" +
                "\t\tif (null != d.getAttribute(a) && 0 <= d.getAttribute(a).indexOf(c)) {\n" +
                "\t\t\td.style.background = \"red\";\n" +
                "\t\t\ta = getPosInDom(d);\n" +
                "\t\t\tvar f = a[0],\n" +
                "\t\t\t\tg = a[1],\n" +
                "\t\t\t\tl = a[2],\n" +
                "\t\t\t\th = a[3];\n" +
                "\t\t\tb = \"true\";\n" +
                "\t\t\tbreak\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: b,\n" +
                "\t\toffsetLeft: f,\n" +
                "\t\toffsetTop: g,\n" +
                "\t\toffsetWidth: l,\n" +
                "\t\toffsetHeight: h\n" +
                "\t})\n" +
                "}\n" +
                "function getpos_58(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tvar b = $j(\"li\");\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).prop(\"outerHTML\").toLowerCase().indexOf(\"zhineng.58.com\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"yellow\")\n" +
                "\t} else \"1\" == c && (b = $j(\"li\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).prop(\"outerHTML\").indexOf(\".shtml\")\n" +
                "\t}), SetBgColor(b, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_jd(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"div.search_prolist_item\");\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"div\").attr(\"tourl\").toLowerCase().indexOf(\"wq.jd.com\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.eq(0);\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div.search_prolist_item\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"div\").attr(\"tourl\").toLowerCase().indexOf(\"ccc-x.jd.com\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.eq(0), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_sm(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"div.result.c-container\");\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 == $j(this).find(\"a\").attr(\"href\").indexOf(\"m.sm.cn/adclick\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div[ad_dot_url]\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"m.sm.cn/adclick\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a\").first(), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_sogou(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"div.result,div.vrResult\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"uid=\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a\").first();\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div.ad_result\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"m.sogou.com/bill\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a\").first(), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_taobao(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"li\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"m.tmall.com\") || -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"m.taobao.com\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"h3\").eq(0);\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"li\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"mclick.simba.\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = b.find(\"h3\").eq(0), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_tmall(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"a\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).attr(\"href\").toLowerCase().indexOf(\"detail.tmall.com/item\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"h3\").eq(0);\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"li\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"mclick.simba.\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = b.find(\"h3\").eq(0), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_pdd(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"div.cell\");\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn 0 == $j(this).find(\"div.search-gg-logo\").length\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"div.name-block\");\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div.cell\"), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn 0 < $j(this).find(\"div.search-gg-logo\").length\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"div.name-block\"), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function getpos_so(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"div.g-card.res-list.og[data-pcurl*='\" + a + \"']\");\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"m.so.com\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a\").first();\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div.tg-wrap\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").toLowerCase().indexOf(\"e.so.com\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a\").first(), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_Bing(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"li\");\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").first().attr(\"href\").toLowerCase().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a\").first();\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"li\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").first().attr(\"href\").toLowerCase().indexOf(\"m.baidu.com/baidu\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a\").first(), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_1688(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"a\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).attr(\"href\").toLowerCase().indexOf(\"m.1688.com\")\n" +
                "\t\t});\n" +
                "\t\tb.css(\"background-color\", \"red\");\n" +
                "\t\tb = b.find(\"span\").first();\n" +
                "\t\tb.css(\"background-color\", \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div.list_group-item\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).prop(\"outerHTML\").toLowerCase().indexOf(\"dj.1688.com\")\n" +
                "\t}), b.css(\"background-color\", \"red\"), b = b.find(\"div.item-info_title\"), b = b.find(\"span\"), b.css(\"background-color\", \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_SWT() {\n" +
                "\tvar a = \"false\",\n" +
                "\t\tc = document.getElementsByTagName(\"a\"),\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = 0,\n" +
                "\t\tg = 0,\n" +
                "\t\tl = 0,\n" +
                "\t\th = 0;\n" +
                "\t\"CSS1Compat\" == document.compatMode ? (l = document.documentElement.clientHeight, h = document.documentElement.clientWidth) : \"BackCompat\" == document.compatMode && (l = document.body.clientHeight, h = document.body.clientWidth);\n" +
                "\tfor (i = 0; i < c.length; i++) {\n" +
                "\t\tvar m = c[i],\n" +
                "\t\t\tk = m.outerHTML;\n" +
                "\t\tif ((-1 < k.indexOf(\"openZoosUrl\") || -1 < k.indexOf(\"goswtUrl\") || -1 < k.indexOf(\"swtClick\") || -1 < k.indexOf(\"/SWT/\") || -1 < k.indexOf(\"kht.zoosnet.net\") || -1 < k.indexOf(\"mswt_online\") || -1 < k.indexOf(\"http://swt.\")) && 0 < m.offsetWidth) {\n" +
                "\t\t\tsetColor(m, \"red\");\n" +
                "\t\t\tm.click();\n" +
                "\t\t\ta = \"true\";\n" +
                "\t\t\tc = getPosInDom(m);\n" +
                "\t\t\tb = c[0];\n" +
                "\t\t\td = c[1];\n" +
                "\t\t\tf = c[2];\n" +
                "\t\t\tg = c[3];\n" +
                "\t\t\tbreak\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: a,\n" +
                "\t\toffsetLeft: b,\n" +
                "\t\toffsetTop: d,\n" +
                "\t\twidth: f,\n" +
                "\t\theight: g,\n" +
                "\t\tclientHeight: l,\n" +
                "\t\tclientWidth: h\n" +
                "\t})\n" +
                "}\n" +
                "function InputQuestion(a) {\n" +
                "\tvar c = $j(\"#texteditor,#inputbox\");\n" +
                "\tc.css(\"background-color\", \"green\");\n" +
                "\tc.val(a);\n" +
                "\ta = $j(\"#sentButton,#enter\");\n" +
                "\ta.css(\"background-color\", \"green\");\n" +
                "\ta.click()\n" +
                "}\n" +
                "function GetPos_ZhiDao(a, c) {\n" +
                "\ta = a.toLowerCase();\n" +
                "\tif (\"1\" == c) {\n" +
                "\t\tvar b = $j(\"div.w-solved-list-li\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).prop(\"outerHTML\").toLowerCase().indexOf(\"/question\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a\").first();\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"0\" == c && (b = $j(\"div.ec-aditem.ec-zhidao-new,div.w-solved-list-li.ecom-wrap\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().toLowerCase().indexOf(a)\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).prop(\"outerHTML\").toLowerCase().indexOf(\"m.baidu.com/baidu.php\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a\").first(), SetBgColor(b, \"yellow\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function ScrollToDown(a) {\n" +
                "\t$j(document).scrollTop($j(document).scrollTop() + a);\n" +
                "\ta = $j(document).height();\n" +
                "\tvar c = $j(window).height(),\n" +
                "\t\tb = $j(document).scrollTop();\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tscrollHeight: a,\n" +
                "\t\tclientHeight: c,\n" +
                "\t\tscrollTop: b\n" +
                "\t})\n" +
                "}\n" +
                "function GetPos_BaiDu_Chrome(a, c) {\n" +
                "\tvar b, d = \"false\";\n" +
                "\ta = a.toLowerCase();\n" +
                "\tvar f = document.documentElement.clientHeight;\n" +
                "\tfor (b = 0; b < document.all.length; b++) {\n" +
                "\t\te = document.all[b];\n" +
                "\t\ttagName = e.tagName;\n" +
                "\t\tvar g = SetNullValue(e.innerText);\n" +
                "\t\tattrValue = getAttr(e, \"class\");\n" +
                "\t\tattrValue2 = getAttr(e, \"data-click\");\n" +
                "\t\tif (\"DIV\" == tagName && (-1 < attrValue.indexOf(\"c-container\") || -1 < attrValue2.indexOf(\"fm\")) && -1 < g.indexOf(a) && 0 < e.offsetWidth) for (setColor(e, \"red\"), es = e.getElementsByTagName(\"*\"), g = 0; g < es.length; g++) if (e2 = es[g], tagName2 = SetNullValue(e2.tagName), \"A\" == tagName2 && 0 < e2.offsetWidth) {\n" +
                "\t\t\thref = SetNullValue(e2.getAttribute(\"href\"));\n" +
                "\t\t\tif (\"0\" == c && -1 < href.indexOf(\"www.baidu.com/baidu\")) {\n" +
                "\t\t\t\tsetColor(e2, \"yellow\");\n" +
                "\t\t\t\td = getPosInDom(e2);\n" +
                "\t\t\t\tvar l = d[0],\n" +
                "\t\t\t\t\th = d[1],\n" +
                "\t\t\t\t\tm = d[2],\n" +
                "\t\t\t\t\tk = d[3];\n" +
                "\t\t\t\td = \"true\";\n" +
                "\t\t\t\tbreak\n" +
                "\t\t\t}\n" +
                "\t\t\tif (\"1\" == c && -1 < href.indexOf(\"www.baidu.com/link\")) {\n" +
                "\t\t\t\tsetColor(e2, \"green\");\n" +
                "\t\t\t\td = getPosInDom(e2);\n" +
                "\t\t\t\tl = d[0];\n" +
                "\t\t\t\th = d[1];\n" +
                "\t\t\t\tm = d[2];\n" +
                "\t\t\t\tk = d[3];\n" +
                "\t\t\t\td = \"true\";\n" +
                "\t\t\t\tbreak\n" +
                "\t\t\t}\n" +
                "\t\t}\n" +
                "\t\tif (-1 < d.indexOf(\"true\")) break\n" +
                "\t}\n" +
                "\treturn g = JSON.stringify({\n" +
                "\t\tresult: d,\n" +
                "\t\toffsetLeft: l,\n" +
                "\t\toffsetTop: h,\n" +
                "\t\toffsetWidth: m,\n" +
                "\t\toffsetHeight: k,\n" +
                "\t\tclientHeight: f\n" +
                "\t})\n" +
                "}\n" +
                "function GetNextPage_Baidu_Chrome() {\n" +
                "\tvar a = document.getElementById(\"page\").getElementsByTagName(\"A\");\n" +
                "\ta = a[a.length - 1];\n" +
                "\tsetColor(a, \"red\");\n" +
                "\ta = getPosInDom(a);\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: \"true\",\n" +
                "\t\toffsetLeft: a[0],\n" +
                "\t\toffsetTop: a[1],\n" +
                "\t\toffsetWidth: a[2],\n" +
                "\t\toffsetHeight: a[3],\n" +
                "\t\tclientHeight: document.documentElement.clientHeight\n" +
                "\t})\n" +
                "}\n" +
                "function GetXGSS(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tvar b = $j(\"a\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j.trim($j(this).text()) == a\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).attr(\"href\").indexOf(c)\n" +
                "\t});\n" +
                "\tSetBgColor(b, \"red\");\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPosFromXL(a, c) {\n" +
                "\tif (-1 < a.indexOf(\"www.baidu.com\")) {\n" +
                "\t\tvar b = $j(\"#form\").find(\"li\").filter(function() {\n" +
                "\t\t\treturn $j(this).text().toLowerCase() === c\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\")\n" +
                "\t} else -1 < a.indexOf(\"www.sogou.com\") ? (b = $j(\"ul.suglist li\").filter(function() {\n" +
                "\t\treturn $j(this).text().toLowerCase() === c\n" +
                "\t}), SetBgColor(b, \"red\")) : -1 < a.indexOf(\"www.so.com\") ? (b = $j(\"ul.ac_menu li\").filter(function() {\n" +
                "\t\treturn $j(this).text().toLowerCase() === c\n" +
                "\t}), SetBgColor(b, \"red\")) : -1 < a.indexOf(\"www.taobao.com\") ? (b = $j(\"div[id^='ks-component']\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).text().toLowerCase() === c\n" +
                "\t}), SetBgColor(b, \"red\")) : -1 < a.indexOf(\"www.bing.com\") ? (b = $j(\"ul#sa_ul li\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).text().toLowerCase() === c\n" +
                "\t}), SetBgColor(b, \"red\")) : -1 < a.indexOf(\"www.1688.com\") && (b = $j(\"ul.suggest_left_list li span\"), b = b.filter(function() {\n" +
                "\t\treturn $j(this).text().toLowerCase() === c\n" +
                "\t}), SetBgColor(b, \"red\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function FindEleByClass(a) {\n" +
                "\treturn document.getElementsByClassName(a)[0]\n" +
                "}\n" +
                "function CloseTip(a) {\n" +
                "\ta.style.display = \"none\"\n" +
                "}\n" +
                "function CloseTip2(a) {\n" +
                "\t$j(window).height();\n" +
                "\ta = $j(\"span.identity-close\");\n" +
                "\tSetBgColor(a, \"red\");\n" +
                "\ta = a.find(\"i\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetPos_Sogou_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tc = $j(\"div.biz_rb,div.bizr_rb,div.vrwrap,div.rb\");\n" +
                "\t\tvar b = c.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"www.sogou.com/bill\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a:first\");\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"1\" == c && (c = $j(\"div.rb,div.vrwrap\"), b = c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"/link?url=\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a:first\"), b.css(\"background-color\", \"green\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_query(a) {\n" +
                "\tvar c = 0,\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = 0;\n" +
                "\t0 < a.length && (c = Math.floor(a.offset().left), b = Math.floor(a.offset().top), d = Math.floor(a.width()), f = Math.floor(a.height()));\n" +
                "\treturn result = [c, b, d, f]\n" +
                "}\n" +
                "function ScrollToDown_query(a) {\n" +
                "\tvar c = 0,\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = document.compatMode;\n" +
                "\t\"CSS1Compat\" == f ? (document.documentElement.scrollTop += a, c = document.documentElement.scrollHeight, b = document.documentElement.clientHeight, d = document.documentElement.scrollTop) : \"BackCompat\" == f && (document.body.scrollTop += a, c = document.body.scrollHeight, b = document.body.clientHeight, d = document.body.scrollTop);\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tscrollHeight: c,\n" +
                "\t\tclientHeight: b,\n" +
                "\t\tscrollTop: d\n" +
                "\t})\n" +
                "}\n" +
                "function ScrollToRight_query(a) {\n" +
                "\tvar c = 0,\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = document.compatMode;\n" +
                "\t\"CSS1Compat\" == f ? (document.documentElement.scrollLeft += a, c = document.documentElement.scrollWidth, b = document.documentElement.clientWidth, d = document.documentElement.scrollLeft) : \"BackCompat\" == f && (document.body.scrollLeft += a, c = document.body.scrollWidth, b = document.body.clientWidth, d = document.body.scrollLeft);\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tscrollWidth: c,\n" +
                "\t\tclientWidth: b,\n" +
                "\t\tscrollLeft: d\n" +
                "\t})\n" +
                "}\n" +
                "function GetElement_query(a, c) {\n" +
                "\ta = $j(\"[\" + a + \"=\" + c + \"]\");\n" +
                "\tSetBgColor(a, \"red\");\n" +
                "\treturn a\n" +
                "}\n" +
                "function GetInputPos_baidu_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\t$j(window).width();\n" +
                "\tvar b; - 1 < a.indexOf(\"www.baidu.com\") ? \"False\" == c ? b = $j(\"#kw\") : \"True\" == c && (b = $j(\"#kw\")) : -1 < a.indexOf(\"www.so.com\") ? \"False\" == c ? b = $j(\"#input\") : \"True\" == c && (b = $j(\"#keyword\")) : -1 < a.indexOf(\"www.sogou.com\") ? \"False\" == c ? b = $j(\"#query\") : \"True\" == c && (b = $j(\"#upquery\")) : -1 < a.indexOf(\"www.taobao.com\") ? b = $j(\"#q\") : -1 < a.indexOf(\"www.tmall.com\") ? b = $j(\"#mq\") : -1 < a.indexOf(\"www.1688.com\") ? \"False\" == c ? b = $j(\"#alisearch-keywords\") : \"True\" == c && (b = $j(\"input[name='keywords']:first\")) : -1 < a.indexOf(\"58.com\") ? \"False\" == c ? b = $j(\"#keyword\") : \"True\" == c && (b = $j(\"#keyword1\")) : -1 < a.indexOf(\"www.jd.com\") ? b = $j(\"#key\") : -1 < a.indexOf(\"www.bing.com\") ? b = $j(\"#sb_form_q\") : -1 < a.indexOf(\"zhidao.baidu.com\") ? b = $j(\"#kw\") : -1 < a.indexOf(\"mobile.yangkeduo.com/search_result.html\") && (b = $j(\"#result-input\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_Baidu_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tc = $j(\"div.c-container,div[data-click*='fm']\");\n" +
                "\t\tvar b = c.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").prop(\"outerHTML\").indexOf(\"www.baidu.com/baidu\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tb = b.find(\"a:first\");\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"1\" == c && (c = $j(\"div[class*='result c-container']\"), b = c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"www.baidu.com/link\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a:first\"), b.css(\"background-color\", \"green\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function NextPage(a) {\n" +
                "\t$j(window).height();\n" +
                "\tvar c = $j(\"a\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t});\n" +
                "\ta = -1 < a.indexOf(\"http://www.sogou.com\") ? $j(\"#sogou_next\") : -1 < a.indexOf(\"http://m.baidu.com\") ? c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).prop(\"outerHTML\").indexOf(\"new-nextpage-only\")\n" +
                "\t}) : c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(\"\\u4e0b\\u4e00\\u9875\")\n" +
                "\t});\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function SetBgColor(a, c) {\n" +
                "\ta.css(\"background-color\", c)\n" +
                "}\n" +
                "function IsElement(a, c) {\n" +
                "\tvar b = \"true\";\n" +
                "\ta = document.elementFromPoint(a, c);\n" +
                "\ta == window.ele ? b = \"true\" : a != window.ele && (a = $j(a), a = $j(window.ele).has(a).length, 0 == a ? (b = \"false\", void 0 != window.ele && window.ele.focus()) : 0 < a && (b = \"true\"));\n" +
                "\treturn b\n" +
                "}\n" +
                "function GetPos_So_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tc = $j(\"li\");\n" +
                "\t\tvar b = c.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").prop(\"outerHTML\").indexOf(\"e.so.com\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tSetBgColor(b.find(\"a:first\"), \"yellow\");\n" +
                "\t\tb = b.find(\"a:first\")\n" +
                "\t} else \"1\" == c && (c = $j(\"li\"), b = c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"www.so.com/link\") || -1 < $j(this).find(\"a\").attr(\"href\").indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), SetBgColor(b, \"red\"), SetBgColor(b.find(\"a:first\"), \"green\"), b = b.find(\"a:first\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_1688_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tvar b = $j(\"li\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t});\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tvar d = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").prop(\"outerHTML\").indexOf(\"dj.1688.com\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(d, \"red\");\n" +
                "\t\tSetBgColor(d.find(\"a:first\"), \"yellow\");\n" +
                "\t\td = d.find(\"a:first\")\n" +
                "\t} else \"1\" == c && (d = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"detail.1688.com\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), SetBgColor(d, \"red\"), SetBgColor(d.find(\"a:first\"), \"green\"), d = d.find(\"a:first\"));\n" +
                "\treturn GetjQueryObjPosition(d)\n" +
                "}\n" +
                "function GetPos_Taobao_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tvar b = $j(\"div.item.J_MouserOnverReq,li.oneline\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t});\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tvar d = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a\").prop(\"outerHTML\").indexOf(\"click.simba.taobao.com\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tSetBgColor(d.find(\"a\").first(), \"yellow\");\n" +
                "\t\td = d.find(\"a\").first()\n" +
                "\t} else \"1\" == c && (d = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"item.taobao.com\") || -1 < $j(this).find(\"a\").attr(\"href\").indexOf(\"detail.tmall.com\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), SetBgColor(d, \"red\"), SetBgColor(d.find(\"a\").first(), \"green\"), d = d.find(\"a\").first());\n" +
                "\treturn GetjQueryObjPosition(d)\n" +
                "}\n" +
                "function GetPos_Tmall_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tvar b = $j(\"a\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t});\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tvar d = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).prop(\"outerHTML\").indexOf(\"click.simba.taobao.com\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(d, \"yellow\")\n" +
                "\t} else \"1\" == c && (d = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).attr(\"href\").indexOf(\"detail.tmall.com\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), SetBgColor(d, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(d)\n" +
                "}\n" +
                "function GetPos_JD_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tvar b = $j(\"li\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t});\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tvar d = b.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).find(\"a:first\").attr(\"href\").indexOf(\"ccc-x.jd.com\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t});\n" +
                "\t\td = d.find(\"a\").eq(1);\n" +
                "\t\tSetBgColor(d, \"yellow\")\n" +
                "\t} else \"1\" == c && (d = b.filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a:first\").attr(\"href\").indexOf(\"item.jd.com\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn 0 < $j(this).text().trim().length\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}), d = d.find(\"a\").eq(1), SetBgColor(d, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(d)\n" +
                "}\n" +
                "function GetPos_Bing_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tc = $j(\".b_ad li\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(c, \"red\");\n" +
                "\t\tvar b = c.find(\"a:first\");\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"1\" == c && (c = $j(\"li.b_algo\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}), b = c.find(\"a\").eq(0), SetBgColor(b, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_zhidao_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tc = $j(\"tr\").filter(function() {\n" +
                "\t\t\treturn $j(this).is(\":visible\")\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t}).filter(function() {\n" +
                "\t\t\treturn 0 < $j(this).text().indexOf(\"\\u5e7f\\u544a\")\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(c, \"red\");\n" +
                "\t\tvar b = c.prev();\n" +
                "\t\tb = b.find(\"a:first\");\n" +
                "\t\tSetBgColor(b, \"green\")\n" +
                "\t} else \"1\" == c && (c = $j(\"dl\"), b = c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).find(\"a:first\").text().indexOf(a)\n" +
                "\t}), SetBgColor(b, \"red\"), b = b.find(\"a:first\"), SetBgColor(b, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_58_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tvar b = $j(\"a\").filter(function() {\n" +
                "\t\treturn $(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $(this).text().toLowerCase().indexOf(a)\n" +
                "\t});\n" +
                "\tSetBgColor(b, \"red\");\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tvar d = b.filter(function() {\n" +
                "\t\t\treturn -1 < $(this).attr(\"href\").toLowerCase().indexOf(\"zhineng.58.com\")\n" +
                "\t\t});\n" +
                "\t\t0 < d.length && SetBgColor(d, \"yellow\")\n" +
                "\t} else \"1\" == c && (d = b.filter(function() {\n" +
                "\t\treturn -1 < $(this).attr(\"href\").toLowerCase().indexOf(\".shtml\")\n" +
                "\t}), 0 < d.length && SetBgColor(d, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(d)\n" +
                "}\n" +
                "function GetPos_PDD_query(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (\"0\" == c) {\n" +
                "\t\tc = $j(\"div.cell\");\n" +
                "\t\tvar b = c.filter(function() {\n" +
                "\t\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t\t});\n" +
                "\t\tb = b.filter(function() {\n" +
                "\t\t\treturn 0 < $j(this).find(\"div.search-gg-logo\").length\n" +
                "\t\t});\n" +
                "\t\tSetBgColor(b, \"red\");\n" +
                "\t\tSetBgColor(b, \"yellow\")\n" +
                "\t} else \"1\" == c && (c = $j(\"div.cell\"), b = c.filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}), b = b.filter(function() {\n" +
                "\t\treturn 0 >= $j(this).find(\"div.search-gg-logo\").length\n" +
                "\t}), SetBgColor(b, \"red\"), SetBgColor(b, \"green\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetSubmitBtnPos(a, c) {\n" +
                "\t$j(window).height();\n" +
                "\tif (-1 < a.indexOf(\"www.baidu.com\")) var b = $j(\"#su\");\n" +
                "\telse -1 < a.indexOf(\"www.so.com\") ? \"False\" == c ? b = $j(\"#search-button\") : \"True\" == c && (b = $j(\"#su\")) : -1 < a.indexOf(\"www.sogou.com\") ? \"False\" == c ? b = $j(\"#stb\") : \"True\" == c && (b = $j(\"#keyword\")) : -1 < a.indexOf(\"www.taobao.com\") ? \"False\" == c ? b = $j(\"button.btn-search.tb-bg\") : \"True\" == c && (b = $j(\"button.submit.icon-btn-search\")) : -1 < a.indexOf(\"www.tmall.com\") ? b = $j(\"button[type='submit']\") : -1 < a.indexOf(\"www.1688.com\") ? \"False\" == c ? b = $j(\"#alisearch-submit\") : \"True\" == c && (b = $j(\"span.sm-widget-txt\"), b = b.filter(function() {\n" +
                "\t\treturn \"\\u641c\\u7d22\" == $j(this).text()\n" +
                "\t})) : -1 < a.indexOf(\"58.com\") ? \"False\" == c ? b = $j(\"#searchbtn\") : \"True\" == c && (b = $j(\"#searchbtn1\")) : -1 < a.indexOf(\"www.jd.com\") ? b = $j(\"button.button\") : -1 < a.indexOf(\"www.bing.com\") ? b = $j(\"#sb_form_go\") : -1 < a.indexOf(\"zhidao.baidu.com\") ? b = $j(\"#search-btn\") : -1 < a.indexOf(\"http://mobile.yangkeduo.com/search_result.html\") && (b = $j(\"div.submit-button-view\"));\n" +
                "\treturn GetjQueryObjPosition(b)\n" +
                "}\n" +
                "function GetPos_SWT_query() {\n" +
                "\t$j(window).height();\n" +
                "\tvar a = $j(\"[onclick*='openZoosUrl'],[onclick*='goswtUrl'],[href*='swtClick'],[href*='/SWT/'],[href*='/swt/'],[href*='kht.zoosnet.net'],[onclick*='swt_online()'],[onclick*='swtClick()']\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t});\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function SWT_Input(a) {\n" +
                "\tvar c = $j(\"#FreeTextBox1_editor\").contents().find(\"body\");\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\tc.text(a)\n" +
                "}\n" +
                "function GetPos_PriceMin() {\n" +
                "\t$j(window).height();\n" +
                "\tvar a = $j(\"input.J_SortbarPriceInput.input\");\n" +
                "\tif (0 < a.length) {\n" +
                "\t\tvar c = a.eq(0);\n" +
                "\t\tSetBgColor(c, \"green\")\n" +
                "\t}\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputMin(a) {\n" +
                "\tvar c = \"false\",\n" +
                "\t\tb = $j(\"input.J_SortbarPriceInput.input\");\n" +
                "\t0 < b.length && (b.eq(0).val(a), c = \"true\");\n" +
                "\treturn c\n" +
                "}\n" +
                "function GetPos_PriceMax() {\n" +
                "\t$j(window).height();\n" +
                "\tvar a = $j(\"input.J_SortbarPriceInput.input\");\n" +
                "\tif (0 < a.length) {\n" +
                "\t\tvar c = a.eq(1);\n" +
                "\t\tSetBgColor(c, \"green\")\n" +
                "\t}\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function InputMax(a) {\n" +
                "\tvar c = \"false\",\n" +
                "\t\tb = $j(\"input.J_SortbarPriceInput.input\");\n" +
                "\t0 < b.length && (b.eq(1).val(a), c = \"true\");\n" +
                "\treturn c\n" +
                "}\n" +
                "function GetCurrentScroll() {\n" +
                "\tvar a = 0,\n" +
                "\t\tc = 0;\n" +
                "\t\"CSS1Compat\" == document.compatMode ? (a = document.documentElement.scrollTop, c = document.documentElement.scrollLeft) : \"BackCompat\" == document.compatMode && (a = document.body.scrollTop, c = document.body.scrollLeft);\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tscrollTop: a,\n" +
                "\t\tscrollLeft: c\n" +
                "\t})\n" +
                "}\n" +
                "function GetPos_TaoBaoSort(a) {\n" +
                "\t$j(window).height();\n" +
                "\tvar c = $j(\"ul.sorts li.sort\").filter(function() {\n" +
                "\t\treturn -1 < $j(this).text().indexOf(a)\n" +
                "\t}).find(\"a\");\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function SetScrollTop() {\n" +
                "\t$j(window).scrollTop(0);\n" +
                "\treturn \"true\"\n" +
                "}\n" +
                "function GetPos_FHD() {\n" +
                "\tvar a = $j(\"span.text\").filter(function() {\n" +
                "\t\treturn \"\\u53d1\\u8d27\\u5730\" == $j(this).text()\n" +
                "\t});\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetjQueryObjPosition(a) {\n" +
                "\tvar c = \"false\",\n" +
                "\t\tb = 0,\n" +
                "\t\td = 0,\n" +
                "\t\tf = 0,\n" +
                "\t\tg = 0,\n" +
                "\t\tl = $j(window).height(),\n" +
                "\t\th = $j(window).width();\n" +
                "\tvoid 0 != a && 0 < a.length && (window.ele = a[0], c = \"true\", a = GetPos_query(a), b = a[0], d = a[1], f = a[2], g = a[3]);\n" +
                "\treturn JSON.stringify({\n" +
                "\t\tresult: c,\n" +
                "\t\toffsetLeft: b,\n" +
                "\t\toffsetTop: d,\n" +
                "\t\twidth: f,\n" +
                "\t\theight: g,\n" +
                "\t\tclientHeight: l,\n" +
                "\t\tclientWidth: h\n" +
                "\t})\n" +
                "}\n" +
                "function GetPos_FHDInputPosition() {\n" +
                "\tvar a = $j(\"input.J_SortbarLocationInput.input\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function InputValue(a, c) {\n" +
                "\ta.val(c)\n" +
                "}\n" +
                "function InputFHD(a) {\n" +
                "\tvar c = !1,\n" +
                "\t\tb = $j(\"input.J_SortbarLocationInput.input\");\n" +
                "\t0 < b.length && (InputValue(b, a), c = !0);\n" +
                "\treturn c\n" +
                "}\n" +
                "function GetPos_FHDSubmitBtn() {\n" +
                "\tvar a = $j(\"span.J_SortbarLocationSubmit.J_SortbarLocationPopupClose.btn\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function HuoBi(a) {\n" +
                "\tvar c = $j(\"a[href*='item.taobao.com']\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 === $j(this).text().indexOf(a)\n" +
                "\t});\n" +
                "\tc = c.eq(Math.ceil(Math.random() * c.length));\n" +
                "\tSetBgColor(c, \"yellow\");\n" +
                "\tc.prop(\"outerHTML\");\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function HuoBi_Mobile(a) {\n" +
                "\tvar c = $j(\"li\").filter(function() {\n" +
                "\t\treturn $j(this).is(\":visible\")\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 === $j(this).text().indexOf(a)\n" +
                "\t}).filter(function() {\n" +
                "\t\treturn -1 < $j(this).prop(\"outerHTML\").indexOf(\"m.taobao.com\") || -1 < $j(this).prop(\"outerHTML\").indexOf(\"m.tmall.com\")\n" +
                "\t});\n" +
                "\tc = c.eq(Math.ceil(Math.random() * c.length));\n" +
                "\tSetBgColor(c, \"yellow\");\n" +
                "\tc = c.find(\"h3\").eq(0);\n" +
                "\tSetBgColor(c, \"green\");\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function GetPos_pinglun() {\n" +
                "\tvar a = $j(\"#J_ReviewTabTrigger,#J_ItemRates\").eq(0);\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetPos_CloseTip(a) {\n" +
                "\tif (a.indexOf(\"www.1688.com\")) var c = $j(\".s-overlay-close-b\");\n" +
                "\treturn GetjQueryObjPosition(c)\n" +
                "}\n" +
                "function CloseTip_JiFen() {\n" +
                "\t$j(\"i.btn-close\").click()\n" +
                "}\n" +
                "function GetToolHeight() {\n" +
                "\tvar a = (window.outerWidth - window.innerWidth) / 2;\n" +
                "\treturn JSON.stringify({\n" +
                "\t\theight: window.outerHeight - window.innerHeight - a,\n" +
                "\t\tborderWidth: a\n" +
                "\t})\n" +
                "}\n" +
                "function GetDocScrollHeight() {\n" +
                "\treturn $j(document).height()\n" +
                "}\n" +
                "function GetPos_XialaBtn() {\n" +
                "\tvar a = $j(\"span.iconfont-common.header-option-icon\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "}\n" +
                "function GetPos_Xiala_Search() {\n" +
                "\tvar a = a = $j(\"a.msg-link.search-logo\");\n" +
                "\tSetBgColor(a, \"green\");\n" +
                "\treturn GetjQueryObjPosition(a)\n" +
                "};";
        this.webView.setWebViewClient(new WebViewClient() {
            public void onPageFinished(WebView webView, final String url) {
                super.onPageFinished(webView, url);
                if (url.equals("https://m.baidu.com/")) {
                    Observable.create(new ObservableOnSubscribe<TaskData>() {
                        @Override
                        public void subscribe(ObservableEmitter<TaskData> emitter) throws Exception {
                            emitter.onNext(taskData);
                            Toast.makeText(getActivity(), "正在输入关键词: " + taskData.getKeyWord(), Toast.LENGTH_SHORT).show();
                        }
                    }).observeOn(AndroidSchedulers.mainThread()).delay(getRanTime(5000), TimeUnit.MILLISECONDS).map(new Function<TaskData, TaskData>() {
                        @Override
                        public TaskData apply(TaskData taskData) throws Exception {
                            InputKey(taskData.getURLS(), taskData.getKeyWord());
                            Toast.makeText(getActivity(), "正在点击搜索按钮", Toast.LENGTH_SHORT).show();
                            return taskData;
                        }
                    }).delay(getRanTime(5000), TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread())
                            .map(submitSearch()).subscribe(new Consumer<TaskData>() {
                        @Override
                        public void accept(TaskData o) throws Exception {

                        }
                    });
                }
            }

            @Override
            public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
                super.onReceivedError(view, request, error);
            }

        });


        this.webView.setWebChromeClient(new WebChromeClient() {
            public boolean onJsAlert(WebView paramAnonymousWebView, String paramAnonymousString1, String paramAnonymousString2, JsResult paramAnonymousJsResult) {
                new android.support.v7.app.AlertDialog.Builder(getActivity()).setTitle("找对了!").setMessage(paramAnonymousString2).setPositiveButton("ok", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {
                    }
                }).show();
                paramAnonymousJsResult.confirm();
                return true;
            }
        });


    }


    public void InputKey(final String url, final String keyword) {
        if (url.contains("zhidao.baidu.com")) {
            findElement("GetPos_XialaBtn()", new JSListener() {
                @Override
                public void onReceiveValue(String value) {
                    p = new double[]{0.0D, 0.0D};
                    p = getAbsolutePos(webView);
                    new JSUseAndroid().tap(p[0], p[1]);

                    Observable.timer(getRanTime(5000), TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<Long>() {
                        @Override
                        public void accept(Long aLong) throws Exception {
                            findElement("GetPos_Xiala_Search()", (JSListener) value1 -> {
                                p = new double[]{0.0D, 0.0D};
                                p = getAbsolutePos(webView);
                                new JSUseAndroid().tap(p[0], p[1]);
                            });
                        }
                    });

                }
            });

        }
        final String[] str = {"InputKey_Mobile('" + url + "')"};

        findElement(str[0], new JSListener() {
            @Override
            public void onReceiveValue(String value) {
                p = new double[]{0.0D, 0.0D};
                p = getAbsolutePos(webView);
                new JSUseAndroid().tap(p[0], p[1]);
//

//                subscribe(new Consumer<Long>() {
//                    @Override
//                    public void accept(Long aLong) throws Exception {
//                        if ((url.contains("taobao.com")) || (url.contains("tmall.com"))) {
//                            if (url.contains("taobao.com")) {
//                                str[0] = "inputKey_taobao2(false,'" + keyword + "')";
//                            }
//
//
//                            if (url.contains("tmall.com")) {
//                                str[0] = "InputKey_Tmall2(false,'" + keyword + "')";
//                            }
//
//                            p = new double[]{0.0D, 0.0D};
//                            p = getAbsolutePos(webView);
//                            new JSUseAndroid().tap(p[0], p[1]);
////                    if (!sleep(3000)) {
////                        return false;
////                    }
//                        }
//                        findElement("InputKey_Mobile2('" + url + "','" + keyword + "')", new JSListener() {
//                            @Override
//                            public void onReceiveValue(String value) {
//                                Observable.timer(getRanTime(5000), TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<Long>() {
//                                    @Override
//                                    public void accept(Long aLong) throws Exception {
//
//                                    }
//                                });
//                            }
//                        });
//                    }
//                });


            }
        });
    }


    /**
     * 查找网页元素
     *
     * @param paramString
     * @return
     */
    private void findElement(final String paramString, final JSListener callback) {
        webView.loadUrl("javascript:" + jsFile);
        webView.evaluateJavascript(paramString, new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String value) {
                try {
                    if (value.startsWith("\"") && value.endsWith("\"")) {
                        value = value.substring(1, value.length() - 1);
                        value = value.replace("\\", "");
                    }
                    JSONObject paramString = new JSONObject(value);
                    offsetLeft = Integer.valueOf(paramString.getString("offsetLeft"));
                    offsetTop = Integer.valueOf(paramString.getString("offsetTop"));
                    offsetWidth = Integer.valueOf(paramString.getString("width"));
                    offsetHeight = Integer.valueOf(paramString.getString("height"));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                callback.onReceiveValue(value);
            }
        });
    }

    public double[] getAbsolutePos(WebView paramWebView) {
        double d = offsetTop - paramWebView.getScrollY() / this.scale;
        while (this.scale * d + offsetHeight * this.scale > paramWebView.getHeight()) {
            paramWebView.scrollTo(0, paramWebView.getScrollY() + offsetHeight);
            d -= offsetHeight / this.scale;
        }
        return new double[]{this.offsetLeft * this.scale + offsetWidth * this.scale / 2.0F, this.scale * d + this.stateBarHeight + this.titleBarHeight + offsetHeight * this.scale / 2.0F};
    }

    interface JSListener {
        void onReceiveValue(String value);
    }

    public int getStateBarHeight() {
        int i = -1;
        int j = getActivity().getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (j > 0) {
            i = getActivity().getResources().getDimensionPixelSize(j);
        }
        return i;
    }

    public int getTitleBarHeight() {
        Rect localRect1 = new Rect();
        getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect1);
        Rect localRect2 = new Rect();
        webView.getDrawingRect(localRect2);
        webView.getTop();
        return localRect1.height() - localRect2.height();
    }

    public float getscale(WebView paramWebView) {
        return paramWebView.getScale();
    }


    public class MyHandler extends Handler {
        WeakReference<TaskActivity> weakReference;

        public MyHandler(TaskActivity activity) {
            this.weakReference = new WeakReference<TaskActivity>(activity);
        }

        private final static int OPEN_WEB = 0;//打开网页

        private final static int INPUT_KEYWORD = 1;//输入关键词

        private final static int CLICK_SEARCH_BTN = 2;//点击搜索按钮

        @Override
        public void dispatchMessage(Message msg) {
            super.dispatchMessage(msg);
            switch (msg.what) {
                case OPEN_WEB:
                    openWeb();
                    break;
                case INPUT_KEYWORD:
                    inputKeyWord();
                    break;
                case CLICK_SEARCH_BTN:
                    clickSearchBtn();
                    break;
            }
        }

        /**
         * 点击搜索按钮
         */
        private void clickSearchBtn() {

        }

        /**
         * 输入关键词
         */
        private void inputKeyWord() {

        }

        /**
         * 打开网页
         */
        private Consumer openWeb() {
            return (Consumer<Long>) o -> webView.loadUrl("https://m.baidu.com/");
        }
    }

    private int getRanTime(int time) {
        return (int) (Math.random() * time);
    }

    private Function<TaskData, TaskData> submitSearch() {
        return new Function<TaskData, TaskData>() {
            @Override
            public TaskData apply(TaskData s) throws Exception {
                if (s.getURLS().contains("58.com")) {
                    pressEnter();
                    return s;
                }
                if ((s.getURLS().contains("1688.com")) || (s.getURLS().contains("so.com")) || (s.getURLS().contains("mobile.yangkeduo.com/search_result.html")) || (s.getURLS().contains("bing.com")) || (s.getURLS().contains("zhidao.baidu.com"))) {
                    pressSpace();
                    return s;
                }
                submit(s.getURLS());
                return s;
            }
        };

    }

    private void submit(String url) {
        findElement("GetSubmitBtnPos_Mobile('" + url + "')", value -> {

        });
    }

    private void pressSpace() {
        new Thread(new Runnable() {
            public void run() {
                try {
                    new Instrumentation().sendCharacterSync(62);
                } catch (Exception ignored) {
                    ignored.printStackTrace();
                }
            }
        }).start();
    }

    private void pressEnter() {
        new Thread(new Runnable() {
            public void run() {
                try {
                    new Instrumentation().sendCharacterSync(66);
                } catch (Exception localException) {
                    localException.printStackTrace();
                }
            }
        }).start();
    }

}
